<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>8.state_again</title>
</head>
<body>
<div id="app"></div>

<script src="lib/react.development.js"></script>
<script src="lib/react-dom.development.js"></script>
<script src="lib/babel.min.js"></script>

<script type="text/babel">
 class Weather extends React.Component{
     constructor(props) {
         super(props);
         this.state ={isHot: true};
         this.changerWeather =this.changerWeather.bind(this);
     }

     changerWeather(){
         let{isHot} =this.state;
         this.setState({isHot:!isHot})
     }

     render(){
         return <h1 onClick={this.changerWeather}>今天天气很{this.state.isHot? '热':'冷'}</h1>
     }
 }
 
     ReactDOM.render(<Weather/>,document.getElementById("app"))
</script>
</body>
</html>